﻿using System.Data;
using System.Data.SqlClient;

namespace MyWeb.Data
{
    public class ProductImgController : SqlDataProvider
    {
        #region [ProductImg_GetByAll]

        public DataTable ProductImg_GetByAll()
        {
            return GetDataTable("sp_ProductImg_GetByAll");
        }

        #endregion

        #region [ProductImg_GetByProductId]

        public DataTable ProductImg_GetByProductId(string prId)
        {
            var p1 = new SqlParameter("@Product_Id", prId);
            return GetDataTable("sp_ProductImg_GetByProductId", p1);
        }

        #endregion

        #region [ProductImg_Insert]

        public void ProductImg_Insert(ProductImgInfo info)
        {
            var p1 = new SqlParameter("@Product_Id", info.Product_Id);
            var p2 = new SqlParameter("@Image", info.Images);
            ExecuteStoreProcedure("sp_ProductImg_Insert", p1, p2);
        }

        #endregion

        #region [ProductImg_Update]

        public void ProductImg_Update(ProductImgInfo info)
        {
          
            var p1 = new SqlParameter("@Product_Id", info.Product_Id);
            var p2 = new SqlParameter("@Image", info.Images);
            ExecuteStoreProcedure("sp_ProductImg_Update", p1, p2);
        }

        #endregion

        #region [ProductImg_Delete]

        public void ProductImg_Delete(string id)
        {
            var p1 = new SqlParameter("@Product_id", id);
            ExecuteStoreProcedure("sp_ProductImg_Delete", p1);
        }

        #endregion
    }
}